package com.baosight.sczx.zm.service;

import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.threadlocal.UserSession;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.zm.domain.ZM9K;
import com.baosight.sczx.common.zm.cInterface.IndexConfiger;

/**
 * <p>Title: ServiceZM9K.java</p>
 * <p>Description: 设备工单执行情况（更多） </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 梁琦
 * @version 1.0
 * <pre>Histroy:
 *          2012-11-12 上午06:27:44  梁琦  Create
 *</pre>
 */
public class ServiceZM9L  extends ServiceEPBase {

	/**
	 * <p>Title: ServiceZM9K.java</p>
	 * <p>Description: 设备工单执行情况（更多） 初始化 </p>
	 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
	 * <p>Company: Baosight Software</p>
	 * @author 梁琦
	 * @version 1.0
	 * <pre>Histroy:
	 *          2012-11-12 上午06:27:44  梁琦  Create
	 *</pre>
	 */
	public EiInfo initLoad(EiInfo inInfo)
	{
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		EiInfo outInfo = this.query(inInfo);
		return outInfo;
	}
	
	/**
	 * <p>Title: ServiceZM9K.java</p>
	 * <p>Description: 设备工单执行情况（更多）  查询</p>
	 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
	 * <p>Company: Baosight Software</p>
	 * @author 梁琦
	 * @version 1.0
	 * <pre>Histroy:
	 *          2012-11-12 上午06:27:44  梁琦  Create
	 *</pre>
	 */
	public EiInfo query(EiInfo inInfo)
	{
		if("是".equals(IndexConfiger.getInstance().getIsLeader()))
		{
			String Isleader="yes";
			StaticTools.setQueryParameters(inInfo, "isleader",Isleader , true);//添加查询条件
		}
		else
		{ 
			String org=UserSession.getInSessionProperty("orgCode").toString();
			StaticTools.setQueryParameters(inInfo, "fdOrgId",org,true);//添加查询条件
		}
		String status=inInfo.getString("fdStatus");
		if(status.equals("1"))
		{
			EiInfo outInfo = super.query(inInfo, "ZM9K.queryUnfinished", new ZM9K());
			return outInfo;
		}
		else
		{
			EiInfo outInfo = super.query(inInfo, "ZM9K.queryCompleted", new ZM9K());
			return outInfo;
		}
		
	}
}
